<template>
  <el-dialog
    :close-on-click-modal="false"
    :before-close="cancel"
    :visible="visible"
    :title="$t('depositManagement.depositManagement11')"
    width="1300px"
  >
    <!-- 入金管理 -->
    <el-form
      :model="ruleSubForm"
      ref="ruleSubForm"
      label-width="200px"
      :rules="rules"
    >
      <el-col :span="24">
        <el-form-item
          :label="$t('depositManagement.depositManagement2')"
          prop="type"
        >
          <el-select
            :disabled="ruleSubForm.id != undefined"
            v-model="ruleSubForm.type"
            @change="clearValidate"
          >
            <el-option
              v-for="item in shoukuanMode"
              :key="item.id"
              :label="item.value"
              :value="Number(item.id)"
            />
          </el-select>
        </el-form-item>
      </el-col>
      <div v-if="ruleSubForm.type != undefined">
        <!-- 收款名称(中英) -->
        <el-col :span="8">
          <el-form-item
            :label="
              $t('depositManagement.depositManagement1') +
              '(' +
              $t('openCheck.openCheck12') +
              ')'
            "
            prop="name_zh"
          >
            <el-input v-model="ruleSubForm.name_zh"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item
            :label="
              $t('depositManagement.depositManagement1') +
              '(' +
              $t('openCheck.openCheck13') +
              ')'
            "
            prop="name_en"
          >
            <el-input v-model="ruleSubForm.name_en"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item
            :label="
              $t('depositManagement.depositManagement1') +
              '(' +
              $t('openCheck.openCheck26') +
              ')'
            "
            prop="name_tc"
          >
            <el-input v-model="ruleSubForm.name_tc"></el-input>
          </el-form-item>
        </el-col>
        <!-- 收款人姓名(中英) -->
        <el-col :span="8">
          <el-form-item
            :label="
              $t('depositManagement.depositManagement4') +
              '(' +
              $t('openCheck.openCheck12') +
              ')'
            "
            prop="payee_zh"
          >
            <el-input v-model="ruleSubForm.payee_zh"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item
            :label="
              $t('depositManagement.depositManagement4') +
              '(' +
              $t('openCheck.openCheck13') +
              ')'
            "
            prop="payee_en"
          >
            <el-input v-model="ruleSubForm.payee_en"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item
            :label="
              $t('depositManagement.depositManagement4') +
              '(' +
              $t('openCheck.openCheck26') +
              ')'
            "
            prop="payee_tc"
          >
            <el-input v-model="ruleSubForm.payee_tc"></el-input>
          </el-form-item>
        </el-col>
        <!-- 收款人账号 -->
        <el-col :span="8">
          <el-form-item
            :label="$t('depositManagement.depositManagement3')"
            prop="account_zh"
          >
            <el-input v-model="ruleSubForm.account_zh"></el-input>
          </el-form-item>
        </el-col>
        <!-- <el-col :span="12">
          <el-form-item
            :label="
              $t('depositManagement.depositManagement3') +
              '(' +
              $t('openCheck.openCheck13') +
              ')'
            "
            prop="account_en"
          >
            <el-input v-model="ruleSubForm.account_en"></el-input>
          </el-form-item>
        </el-col> -->
        <!-- 收款行SWIFT代码 -->
        <el-col :span="8">
          <el-form-item
            :label="$t('depositManagement.depositManagement7')"
            prop="swift_zh"
          >
            <el-input v-model="ruleSubForm.swift_zh"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8" :style="$store.state.settings.langTail == 'en'?'height:102px':'height:66px'"></el-col>

        <!-- <el-col :span="12">
          <el-form-item
            :label="
              $t('depositManagement.depositManagement7') +
              '(' +
              $t('openCheck.openCheck13') +
              ')'
            "
            prop="swift_en"
          >
            <el-input v-model="ruleSubForm.swift_en"></el-input>
          </el-form-item>
        </el-col> -->
        <div v-if="ruleSubForm.type == '1'">
          <!-- FPS识别码 -->
          <el-col :span="24">
            <el-form-item
              :label="$t('depositManagement.depositManagement10')"
              prop="fps_zh"
            >
              <el-input v-model="ruleSubForm.fps_zh"></el-input>
            </el-form-item>
          </el-col>
          <!-- <el-col :span="12">
            <el-form-item
              :label="
                $t('depositManagement.depositManagement10') +
                '(' +
                $t('openCheck.openCheck13') +
                ')'
              "
              prop="fps_en"
            >
              <el-input v-model="ruleSubForm.fps_en"></el-input>
            </el-form-item>
          </el-col> -->
          <!-- 收款人所在城市(中英) -->
          <el-col :span="8">
            <el-form-item
              :label="
                $t('depositManagement.depositManagement12') +
                '(' +
                $t('openCheck.openCheck12') +
                ')'
              "
              prop="city_zh"
            >
              <el-input v-model="ruleSubForm.city_zh"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item
              :label="
                $t('depositManagement.depositManagement12') +
                '(' +
                $t('openCheck.openCheck13') +
                ')'
              "
              prop="city_en"
            >
              <el-input v-model="ruleSubForm.city_en"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item
              :label="
                $t('depositManagement.depositManagement12') +
                '(' +
                $t('openCheck.openCheck26') +
                ')'
              "
              prop="city_tc"
            >
              <el-input v-model="ruleSubForm.city_tc"></el-input>
            </el-form-item>
          </el-col>
        </div>
        <div v-if="ruleSubForm.type == '2'">
          <!-- 收款人国家/地区（中英） -->
          <el-col :span="8">
            <el-form-item
              :label="
                $t('depositManagement.depositManagement5') +
                '(' +
                $t('openCheck.openCheck12') +
                ')'
              "
              prop="city_zh"
            >
              <el-input v-model="ruleSubForm.city_zh"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item
              :label="
                $t('depositManagement.depositManagement5') +
                '(' +
                $t('openCheck.openCheck13') +
                ')'
              "
              prop="city_en"
            >
              <el-input v-model="ruleSubForm.city_en"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item
              :label="
                $t('depositManagement.depositManagement5') +
                '(' +
                $t('openCheck.openCheck26') +
                ')'
              "
              prop="city_tc"
            >
              <el-input v-model="ruleSubForm.city_tc"></el-input>
            </el-form-item>
          </el-col>
        </div>
        <!-- 收款人地址（中英） -->
        <el-col :span="8">
          <el-form-item
            :label="
              $t('depositManagement.depositManagement6') +
              '(' +
              $t('openCheck.openCheck12') +
              ')'
            "
            prop="address_zh"
          >
            <el-input
              type="textarea"
              v-model="ruleSubForm.address_zh"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item
            :label="
              $t('depositManagement.depositManagement6') +
              '(' +
              $t('openCheck.openCheck13') +
              ')'
            "
            prop="address_en"
          >
            <el-input
              type="textarea"
              v-model="ruleSubForm.address_en"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item
            :label="
              $t('depositManagement.depositManagement6') +
              '(' +
              $t('openCheck.openCheck26') +
              ')'
            "
            prop="address_tc"
          >
            <el-input
              type="textarea"
              v-model="ruleSubForm.address_tc"
            ></el-input>
          </el-form-item>
        </el-col>

        <!-- 提示（中英） -->
        <el-col :span="8">
          <el-form-item
            :label="
              $t('common.common5') + '(' + $t('openCheck.openCheck12') + ')'
            "
          >
            <el-input type="textarea" v-model="ruleSubForm.tip_zh"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item
            :label="
              $t('common.common5') + '(' + $t('openCheck.openCheck13') + ')'
            "
          >
            <el-input type="textarea" v-model="ruleSubForm.tip_en"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item
            :label="
              $t('common.common5') + '(' + $t('openCheck.openCheck26') + ')'
            "
          >
            <el-input type="textarea" v-model="ruleSubForm.tip_tc"></el-input>
          </el-form-item>
        </el-col>
        <!-- 收款开户银行全称（中英） -->
        <el-col :span="8">
          <el-form-item
            :label="
              $t('depositManagement.depositManagement8') +
              '(' +
              $t('openCheck.openCheck12') +
              ')'
            "
            prop="bank_name_zh"
          >
            <el-input v-model="ruleSubForm.bank_name_zh"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item
            :label="
              $t('depositManagement.depositManagement8') +
              '(' +
              $t('openCheck.openCheck13') +
              ')'
            "
            prop="bank_name_en"
          >
            <el-input v-model="ruleSubForm.bank_name_en"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item
            :label="
              $t('depositManagement.depositManagement8') +
              '(' +
              $t('openCheck.openCheck26') +
              ')'
            "
            prop="bank_name_tc"
          >
            <el-input v-model="ruleSubForm.bank_name_tc"></el-input>
          </el-form-item>
        </el-col>
        <div v-if="ruleSubForm.type == '1'">
          <!-- 收款行所在城市（中英） -->
          <el-col :span="8">
            <el-form-item
              :label="
                $t('depositManagement.depositManagement13') +
                '(' +
                $t('openCheck.openCheck12') +
                ')'
              "
              prop="bank_name_city_zh"
            >
              <el-input v-model="ruleSubForm.bank_name_city_zh"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item
              :label="
                $t('depositManagement.depositManagement13') +
                '(' +
                $t('openCheck.openCheck13') +
                ')'
              "
              prop="bank_name_city_en"
            >
              <el-input v-model="ruleSubForm.bank_name_city_en"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item
              :label="
                $t('depositManagement.depositManagement13') +
                '(' +
                $t('openCheck.openCheck26') +
                ')'
              "
              prop="bank_name_city_tc"
            >
              <el-input v-model="ruleSubForm.bank_name_city_tc"></el-input>
            </el-form-item>
          </el-col>
        </div>
        <div v-if="ruleSubForm.type == '2'">
          <!-- 收款行所在国家/地区（中英） -->
          <el-col :span="8">
            <el-form-item
              :label="
                $t('depositManagement.depositManagement14') +
                '(' +
                $t('openCheck.openCheck12') +
                ')'
              "
              prop="bank_name_city_zh"
            >
              <el-input v-model="ruleSubForm.bank_name_city_zh"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item
              :label="
                $t('depositManagement.depositManagement14') +
                '(' +
                $t('openCheck.openCheck13') +
                ')'
              "
              prop="bank_name_city_en"
            >
              <el-input v-model="ruleSubForm.bank_name_city_en"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item
              :label="
                $t('depositManagement.depositManagement14') +
                '(' +
                $t('openCheck.openCheck26') +
                ')'
              "
              prop="bank_name_city_tc"
            >
              <el-input v-model="ruleSubForm.bank_name_city_tc"></el-input>
            </el-form-item>
          </el-col>
          <!-- 收款开户行地址（中英） -->
          <el-col :span="8">
            <el-form-item
              :label="
                $t('depositManagement.depositManagement15') +
                '(' +
                $t('openCheck.openCheck12') +
                ')'
              "
              prop="bank_name_address_zh"
            >
              <el-input
                type="textarea"
                v-model="ruleSubForm.bank_name_address_zh"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item
              :label="
                $t('depositManagement.depositManagement15') +
                '(' +
                $t('openCheck.openCheck13') +
                ')'
              "
              prop="bank_name_address_en"
            >
              <el-input
                type="textarea"
                v-model="ruleSubForm.bank_name_address_en"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item
              :label="
                $t('depositManagement.depositManagement15') +
                '(' +
                $t('openCheck.openCheck26') +
                ')'
              "
              prop="bank_name_address_tc"
            >
              <el-input
                type="textarea"
                v-model="ruleSubForm.bank_name_address_tc"
              ></el-input>
            </el-form-item>
          </el-col>
        </div>
        <!-- 转账附言 -->
        <el-col :span="8">
          <el-form-item
            :label="
              $t('depositManagement.depositManagement9') +
              '(' +
              $t('openCheck.openCheck12') +
              ')'
            "
          >
            <el-input
              type="textarea"
              v-model="ruleSubForm.adjunct_zh"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item
            :label="
              $t('depositManagement.depositManagement9') +
              '(' +
              $t('openCheck.openCheck13') +
              ')'
            "
          >
            <el-input
              type="textarea"
              v-model="ruleSubForm.adjunct_en"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item
            :label="
              $t('depositManagement.depositManagement9') +
              '(' +
              $t('openCheck.openCheck26') +
              ')'
            "
          >
            <el-input
              type="textarea"
              v-model="ruleSubForm.adjunct_tc"
            ></el-input>
          </el-form-item>
        </el-col>
      </div>
    </el-form>
    <div
      slot="footer"
      class="dialog-footer"
      v-if="
        (checkPermission(['deposit@update']) && ruleSubForm.id) ||
        (checkPermission(['deposit@save']) && !ruleSubForm.id)
      "
    >
      <el-button type="info" plain @click="cancel">
        {{ $t("common.common1") }}
      </el-button>
      <el-button
        :loading="submitLoading"
        type="primary"
        plain
        @click="submit('ruleSubForm')"
      >
        {{ $t("common.common2") }}
      </el-button>
    </div>
  </el-dialog>
</template>
<script>
import { CusInfo, addItem, updateItem } from "@/api/systems/depositManagement";
import { shoukuanMode } from "@/assets/js/common";

export default {
  data() {
    return {
      shoukuanMode,
      visible: false,
      submitLoading: false,
      ruleSubForm: {},
      rules: {
        type: [
          {
            required: true,
            message:
              this.$t("common.common27") +
              this.$t("depositManagement.depositManagement2"),
            trigger: "blur",
          },
        ],
        name_zh: [
          {
            required: true,
            message:
              this.$t("common.common26") +
              this.$t("depositManagement.depositManagement1") +
              "(" +
              this.$t("openCheck.openCheck12") +
              ")",
            trigger: "blur",
          },
        ],
        name_en: [
          {
            required: true,
            message:
              this.$t("common.common26") +
              this.$t("depositManagement.depositManagement1") +
              "(" +
              this.$t("openCheck.openCheck13") +
              ")",
            trigger: "blur",
          },
        ],
        name_tc: [
          {
            required: true,
            message:
              this.$t("common.common26") +
              this.$t("depositManagement.depositManagement1") +
              "(" +
              this.$t("openCheck.openCheck26") +
              ")",
            trigger: "blur",
          },
        ],
        payee_zh: [
          {
            required: true,
            message:
              this.$t("common.common26") +
              this.$t("depositManagement.depositManagement4") +
              "(" +
              this.$t("openCheck.openCheck12") +
              ")",
            trigger: "blur",
          },
        ],
        payee_en: [
          {
            required: true,
            message:
              this.$t("common.common26") +
              this.$t("depositManagement.depositManagement4") +
              "(" +
              this.$t("openCheck.openCheck13") +
              ")",
            trigger: "blur",
          },
        ],
        payee_tc: [
          {
            required: true,
            message:
              this.$t("common.common26") +
              this.$t("depositManagement.depositManagement4") +
              "(" +
              this.$t("openCheck.openCheck26") +
              ")",
            trigger: "blur",
          },
        ],
        account_zh: [
          {
            required: true,
            message:
              this.$t("common.common26") +
              this.$t("depositManagement.depositManagement3"),
            trigger: "blur",
          },
          // 收款人账号 必须是数字
          {
            pattern: /^[0-9]+$/,
            message:
              this.$t("depositManagement.depositManagement3") +
              this.$t("depositManagement.depositManagement19"),
            trigger: "blur",
          },
        ],
        // account_en: [
        //   {
        //     required: true,
        //     message:
        //       this.$t("common.common26") +
        //       this.$t("depositManagement.depositManagement3") +
        //       "(" +
        //       this.$t("openCheck.openCheck13") +
        //       ")",
        //     trigger: "blur",
        //   },
        // ],
        fps_zh: [
          {
            required: true,
            message:
              this.$t("common.common26") +
              this.$t("depositManagement.depositManagement10"),
            trigger: "blur",
          },
          // FPS识别码 必须是数字
          {
            pattern: /^[0-9]+$/,
            message:
              this.$t("depositManagement.depositManagement10") +
              this.$t("depositManagement.depositManagement19"),
            trigger: "blur",
          },
        ],
        // fps_en: [
        //   {
        //     required: true,
        //     message:
        //       this.$t("common.common26") +
        //       this.$t("depositManagement.depositManagement10") +
        //       "(" +
        //       this.$t("openCheck.openCheck13") +
        //       ")",
        //     trigger: "blur",
        //   },
        // ],
        city_zh: [
          {
            required: true,
            message:
              this.$t("common.common26") +
              this.$t("depositManagement.depositManagement5") +
              "(" +
              this.$t("openCheck.openCheck12") +
              ")",
            trigger: "blur",
          },
        ],
        city_en: [
          {
            required: true,
            message:
              this.$t("common.common26") +
              this.$t("depositManagement.depositManagement5") +
              "(" +
              this.$t("openCheck.openCheck13") +
              ")",
            trigger: "blur",
          },
        ],
        city_tc: [
          {
            required: true,
            message:
              this.$t("common.common26") +
              this.$t("depositManagement.depositManagement5") +
              "(" +
              this.$t("openCheck.openCheck26") +
              ")",
            trigger: "blur",
          },
        ],
        address_zh: [
          {
            required: true,
            message:
              this.$t("common.common26") +
              this.$t("depositManagement.depositManagement6") +
              "(" +
              this.$t("openCheck.openCheck12") +
              ")",
            trigger: "blur",
          },
        ],
        address_en: [
          {
            required: true,
            message:
              this.$t("common.common26") +
              this.$t("depositManagement.depositManagement6") +
              "(" +
              this.$t("openCheck.openCheck13") +
              ")",
            trigger: "blur",
          },
        ],
        address_tc: [
          {
            required: true,
            message:
              this.$t("common.common26") +
              this.$t("depositManagement.depositManagement6") +
              "(" +
              this.$t("openCheck.openCheck26") +
              ")",
            trigger: "blur",
          },
        ],
        swift_zh: [
          {
            required: true,
            message:
              this.$t("common.common26") +
              this.$t("depositManagement.depositManagement7"),
            trigger: "blur",
          },
          // 8 或者 11位  数字加字母
          // 收款行SWIFT代码为8或11位的字母及数字
          {
            pattern: /^([A-Za-z0-9]{8}|[A-Za-z0-9]{11})$/,
            message: this.$t("depositManagement.depositManagement18"),
            trigger: "blur",
          },
        ],
        // swift_en: [
        //   {
        //     required: true,
        //     message:
        //       this.$t("common.common26") +
        //       this.$t("depositManagement.depositManagement7") +
        //       "(" +
        //       this.$t("openCheck.openCheck13") +
        //       ")",
        //     trigger: "blur",
        //   },
        // ],
        bank_name_zh: [
          {
            required: true,
            message:
              this.$t("common.common26") +
              this.$t("depositManagement.depositManagement8") +
              "(" +
              this.$t("openCheck.openCheck12") +
              ")",
            trigger: "blur",
          },
        ],
        bank_name_en: [
          {
            required: true,
            message:
              this.$t("common.common26") +
              this.$t("depositManagement.depositManagement8") +
              "(" +
              this.$t("openCheck.openCheck13") +
              ")",
            trigger: "blur",
          },
        ],
        bank_name_tc: [
          {
            required: true,
            message:
              this.$t("common.common26") +
              this.$t("depositManagement.depositManagement8") +
              "(" +
              this.$t("openCheck.openCheck26") +
              ")",
            trigger: "blur",
          },
        ],
        bank_name_city_zh: [
          {
            required: true,
            message:
              this.$t("common.common26") +
              this.$t("depositManagement.depositManagement14") +
              "(" +
              this.$t("openCheck.openCheck12") +
              ")",
            trigger: "blur",
          },
        ],
        bank_name_city_en: [
          {
            required: true,
            message:
              this.$t("common.common26") +
              this.$t("depositManagement.depositManagement14") +
              "(" +
              this.$t("openCheck.openCheck13") +
              ")",
            trigger: "blur",
          },
        ],
        bank_name_city_tc: [
          {
            required: true,
            message:
              this.$t("common.common26") +
              this.$t("depositManagement.depositManagement14") +
              "(" +
              this.$t("openCheck.openCheck26") +
              ")",
            trigger: "blur",
          },
        ],
        bank_name_address_zh: [
          {
            required: true,
            message:
              this.$t("common.common26") +
              this.$t("depositManagement.depositManagement15") +
              "(" +
              this.$t("openCheck.openCheck12") +
              ")",
            trigger: "blur",
          },
        ],
        bank_name_address_en: [
          {
            required: true,
            message:
              this.$t("common.common26") +
              this.$t("depositManagement.depositManagement15") +
              "(" +
              this.$t("openCheck.openCheck13") +
              ")",
            trigger: "blur",
          },
        ],
        bank_name_address_tc: [
          {
            required: true,
            message:
              this.$t("common.common26") +
              this.$t("depositManagement.depositManagement15") +
              "(" +
              this.$t("openCheck.openCheck26") +
              ")",
            trigger: "blur",
          },
        ],
      },
    };
  },
  methods: {
    init(rowID) {
      if (rowID) {
        //编辑
        CusInfo(rowID)
          .then((res) => {
            if (res.code == 10000) {
              this.ruleSubForm = res.data;
            } else {
              this.$message.error(res.message);
            }
          })
          .catch((error) => {
            this.$message.error(error.Error);
          });
      } else {
        //新增
        this.ruleSubForm = {};
      }
      this.visible = true;
    },
    cancel() {
      this.ruleSubForm = {};
      // this.$refs['ruleSubForm'].resetFields();
      this.$refs["ruleSubForm"].clearValidate();
      this.visible = false;
    },
    clearValidate(val) {
      if (val == 1) {
        //FPS
        this.rules.city_zh[0].message =
          this.$t("common.common26") +
          this.$t("depositManagement.depositManagement12") +
          "(" +
          this.$t("openCheck.openCheck12") +
          ")";
        this.rules.city_en[0].message =
          this.$t("common.common26") +
          this.$t("depositManagement.depositManagement12") +
          "(" +
          this.$t("openCheck.openCheck13") +
          ")";
        this.rules.city_tc[0].message =
          this.$t("common.common26") +
          this.$t("depositManagement.depositManagement12") +
          "(" +
          this.$t("openCheck.openCheck26") +
          ")";  
        this.rules.bank_name_city_zh[0].message =
          this.$t("common.common26") +
          this.$t("depositManagement.depositManagement13") +
          "(" +
          this.$t("openCheck.openCheck12") +
          ")";
        this.rules.bank_name_city_en[0].message =
          this.$t("common.common26") +
          this.$t("depositManagement.depositManagement13") +
          "(" +
          this.$t("openCheck.openCheck13") +
          ")";
        this.rules.bank_name_city_tc[0].message =
          this.$t("common.common26") +
          this.$t("depositManagement.depositManagement13") +
          "(" +
          this.$t("openCheck.openCheck26") +
          ")";
      } else {
        //银行
        this.rules.city_zh[0].message =
          this.$t("common.common26") +
          this.$t("depositManagement.depositManagement5") +
          "(" +
          this.$t("openCheck.openCheck12") +
          ")";
        this.rules.city_en[0].message =
          this.$t("common.common26") +
          this.$t("depositManagement.depositManagement5") +
          "(" +
          this.$t("openCheck.openCheck13") +
          ")";
        this.rules.city_tc[0].message =
          this.$t("common.common26") +
          this.$t("depositManagement.depositManagement5") +
          "(" +
          this.$t("openCheck.openCheck26") +
          ")";
        this.rules.bank_name_city_zh[0].message =
          this.$t("common.common26") +
          this.$t("depositManagement.depositManagement14") +
          "(" +
          this.$t("openCheck.openCheck12") +
          ")";
        this.rules.bank_name_city_en[0].message =
          this.$t("common.common26") +
          this.$t("depositManagement.depositManagement14") +
          "(" +
          this.$t("openCheck.openCheck13") +
          ")";
        this.rules.bank_name_city_tc[0].message =
          this.$t("common.common26") +
          this.$t("depositManagement.depositManagement14") +
          "(" +
          this.$t("openCheck.openCheck26") +
          ")";
      }
      this.$refs["ruleSubForm"].clearValidate();
    },
    submit(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          // `是否确认提交?`, "提示",
          this.$confirm(this.$t("common.common29"), this.$t("common.common5"), {
            confirmButtonText: this.$t("common.common2"),
            cancelButtonText: this.$t("common.common1"),
            type: "warning",
          })
            .then(() => {
              this.submitLoading = true;
              if (this.ruleSubForm.id) {
                //编辑
                updateItem(this.ruleSubForm.id, this.ruleSubForm)
                  .then((res) => {
                    this.submitLoading = false;
                    if (res.code == 10000) {
                      this.cancel();
                      this.$parent.getList();
                    }
                  })
                  .catch((error) => {
                    this.$message.error(error.Error);
                  });
              } else {
                //新增
                addItem(this.ruleSubForm)
                  .then((res) => {
                    this.submitLoading = false;
                    if (res.code == 10000) {
                      this.cancel();
                      this.$parent.getList();
                    }
                  })
                  .catch((error) => {
                    this.$message.error(error.Error);
                  });
              }
            })
            .catch((error) => {
              this.$message.error(error.Error);
            });
        }
      });
    },
  },
};
</script>
<style rel="stylesheet/scss" lang="scss">
.el-select {
  width: 100%;
}
.el-form-item{
  margin-bottom: 30px;
  .el-form-item__error{
    padding-top: 2px;
  }
}
</style>